<template>
  <div>
    <ul>
      <li v-for="(num, index) in arr" :key="num">
         {{ num }}
         <button @click="del(index)" >删除</button>
      </li>
    </ul>
    <button @click="btn">生成</button>
  </div>
</template>

<script>
export default {
  data () {
    return {
      arr: [1, 3, 5]
    }
  },

  created () {

  },

  methods: {
    btn () {
      this.arr.push(Math.ceil(Math.random() * 9))
    },
    del (index) {
      this.arr.splice(index, 1)
    }
  }
}
</script>

<style scoped lang='less'>

</style>
